Standard Uniform Distribution  

By Hubert Ronald / Leave a response / May 28, 2018

In statistics, the antithetic variates method is a variance reduction technique used in Monte Carlo methods. This last is an interesting property.

In probability theory and statistics, the continuous uniform distribution or rectangular distribution is a family of symmetric probability distributions such that for each member of the family, all intervals of the same length on the distribution's support are equally probable From Wikipedia

Where its cumulative distribution function is:

\begin{equation} F(x) = \begin{cases} 0, & \text{for}\ \ x < a \\ \frac{x-a}{b-a}, & \text{for}\ \ a \leq x \leq b \\ 1, & \text{for}\ \ x > b \end{cases} \end{equation}

Its inverse is:

\( F^{-1}(p) =a+p(b-a) \text{ for } 0<\text{p}<1 \)

if \(a=0\), \(b=1\) and \(p=u\) Standard Uniform Distribution Inverse is:

\( F^{-1}(u) = u \text{ for } 0<\text{u}<1 \)

Note that if \(u=1-u^*\) new Standard Uniform Distribution Inverse is:

\( F^{-1}(u^*) = u^* \text{ for } 0< u^* <1 \)

And the above is known as antithetic variates method. Next, its implementation in C++ is shown:

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;
//-- Standard Uniform Distribution  --
inline double unif(){return ((double)rand()/(double)RAND_MAX);} 

int main()
{
    int run = 50;   //-- Value according to your needs  --
    srand(clock());

    //-- note than expression 1-unif() is going to equal be to unif()  --
    for (int i = 0; i < run; ++i){cout << i<<"   " << 1-unif() << endl;};
    system("pause");
    return 0;
}





Hubert Ronald

Hiya. I'm Ronald, an Industrial Engineer from Colombia. Hope you enjoyed my ad-free, bullshit-free site. If you liked it, tell someone about it.

Write a response

Your email address will not be published.

RECENT NEWS

Gradient is a small library which offers a clean, minimalistic but powerful API for gradients on mesh canvas when you use it on Gideros Mobile. This script take colors from uiGradients like inspiration.

More information about before here.

SUBSCRIBE

Get monthly updates and free resources.


CONNECT WITH ME